package one.three.web.one;

import edu.princeton.cs.algs4.In;
import edu.princeton.cs.algs4.StdDraw;
import edu.princeton.cs.algs4.StdIn;

public class Tail {

	public static void main(String[] args) {
		int k =Integer.parseInt(args[0]);
		String file = args[1];
		In in = new In(file);
		Stack<String> s = new Stack<String>();
		String l;
		while (in.hasNextLine()) {
			l = in.readLine();
			s.push(l);
		}

		for (int i = 0; i < k; i++) {
			l = s.pop();
			System.out.println(l);
		}

	}

}
